package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpYAccountCustomerDetailsUsersTabPageUtil extends SeleniumPageUtil {
	
	public final static By CDUT_SPAN_MAIN_HEADER = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_Header_lblHeader");
	public final static By CDUT_IMG_REPORT_PREFERENCES = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_Header_imgPreferences");
	public final static By CDUT_IMG_EXPORT = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_Header_imgExcelExport");
	public final static By CDUT_LINK_NEW = By.xpath("//*[@id='e0dce11b-40ad-4118-b5d9-84bb06c2b270']/a");
	public final static By CDUT_TD_PAGE = By.xpath("//*[@id='dvReport']/table[2]/tbody/tr/td[1]");
	public final static By CDUT_SPAN_PAGE_START_NO = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_PagingTop_lblPagingPageNumber");
	public final static By CDUT_TD_OF = By.xpath("//*[@id='dvReport']/table[2]/tbody/tr/td[3]");
	public final static By CDUT_SPAN_PAGE_COUNT = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_PagingTop_lblPagingPageCount");
	public final static By CDUT_INPUT_FIRST = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_PagingTop_imgFirst");
	public final static By CDUT_INPUT_PREVIOUS = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_PagingTop_imgPrevious");
	public final static By CDUT_INPUT_NEXT = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_PagingTop_imgNext");
	public final static By CDUT_INPUT_LAST = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_PagingTop_imgLast");
	public final static By CDUT_IMG_FILTER_0 = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_filter_0");
	public final static By CDUT_IMG_FILTER_1 = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_filter_1");
	public final static By CDUT_IMG_FILTER_2 = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_filter_2");
	public final static By CDUT_IMG_FILTER_3 = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_filter_3");
	public final static By CDUT_TH_LOGIN_NAME = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_sort_0");
	public final static By CDUT_TH_DISPLAY_NAME  = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_sort_1");
	public final static By CDUT_TH_EMAIL_ADDRESS = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_sort_2");
	public final static By CDUT_TH_ACTIVE = By.id("ParentChildContainer_CustomerDetails_UserList1_UserListReport_sort_3");
	
	
	public static void enterYourAccountCustomerDetailsUsersPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterYourAccountCustomerDetailsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpYAccountCustomerDetailsDefaultPageUtil.YACD_TAB_USERS));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				CDUT_LINK_NEW, CDUT_IMG_REPORT_PREFERENCES, CDUT_IMG_EXPORT, CDUT_INPUT_FIRST, CDUT_INPUT_PREVIOUS, CDUT_INPUT_NEXT,
				CDUT_INPUT_LAST, CDUT_IMG_FILTER_0, CDUT_IMG_FILTER_1, CDUT_IMG_FILTER_2, CDUT_IMG_FILTER_3
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_LINK_NEW));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_IMG_REPORT_PREFERENCES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_IMG_EXPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_INPUT_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_INPUT_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_INPUT_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_INPUT_LAST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_IMG_FILTER_0));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_IMG_FILTER_1));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_IMG_FILTER_2));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDUT_IMG_FILTER_3));
	}
}
